#if (FEATURE_MODE == 0)
/**
 @file ctc_dot1ae_cli.c

 @author  Copyright (C) 2017 Centec Networks Inc.  All rights reserved.

 @date 2017-08-22

 @version v2.0

 The file apply clis of bpe module
*/

#include "ctc_dot1ae_cli.h"
#include "ctc_dot1ae.h"
#include "ctc_cli.h"
#include "ctc_cli_common.h"
#include "ctc_error.h"
#include "ctc_api.h"
#include "ctcs_api.h"
#include "ctc_debug.h"


CTC_CLI(ctc_cli_dot1ae_update_sec_chan,
        ctc_cli_dot1ae_update_sec_chan_cmd,
        "dot1ae update (sec-chan CHAN_ID) (sci SCI |an-bitmap AN_BITMAP |(next-an AN)  \
       |(replay-protect (enable|disable) | window-size SIZE) | (include-sci|without-sci)|(protocol-type TYPE))",
        "Dot1AE",
        "Update",
        "Dot1AE Security Channel",
        "CHANNEL ID",
        "Secure Channel Identifier",
        "Secure Channel Identifier,64bit",
        "active AN to SC",
        "AN Bitmap",
        "Next-AN to SC",
        "Association Number",
        "Replay-protect",
        "Enable protect",
        "Disable protect",
        "Window-size",
        "Window-size",
        "Protocol type",
        "Type",
        "TX with centec security header",
        "TX without centec security header"
        )
{
    int32  ret = 0;
    uint8  index = 0;
    uint8  sci[8] = {0};
    uint8  sci_tmp[8] = {0};
    uint32 value = 0;
    ctc_dot1ae_sc_t sec_chan;
    uint8  i = 0;

    sal_memset(&sec_chan, 0, sizeof(ctc_dot1ae_sc_t));

    index = CTC_CLI_GET_ARGC_INDEX("sec-chan");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("sec-chan", sec_chan.chan_id, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("sci");
    if (0xFF != index)
    {
        sal_sscanf(argv[index+1], "%16"PRIx64,(uint64*)sci);
        for (i=0;i<sizeof(sci);i++)
        {
            sci_tmp[sizeof(sci)-1-i] = sci[i];
        }
        sec_chan.ext_data= &sci_tmp[0];
        sec_chan.property = CTC_DOT1AE_SC_PROP_SCI;
    }
    index = CTC_CLI_GET_ARGC_INDEX("next-an");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("AN", value, argv[index + 1]);
        sec_chan.data = value;
        sec_chan.property = CTC_DOT1AE_SC_PROP_NEXT_AN;

    }
    index = CTC_CLI_GET_ARGC_INDEX("an-bitmap");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("an-bitmap", value, argv[index + 1]);
        sec_chan.data = value ;
        sec_chan.property = CTC_DOT1AE_SC_PROP_AN_EN;
    }
    index = CTC_CLI_GET_ARGC_INDEX("window-size");
    if (0xFF != index)
    {
        sec_chan.property = CTC_DOT1AE_SC_PROP_REPLAY_WINDOW_SIZE;
        CTC_CLI_GET_UINT64("window-size",sec_chan.data, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("replay-protect");
    if (0xFF != index)
    {
        uint8 enable = 0;
        sec_chan.property = CTC_DOT1AE_SC_PROP_REPLAY_PROTECT_EN;
        if (CLI_CLI_STR_EQUAL("enable", index+1))
        {
            enable = TRUE;
        }
        else
        {
            enable = FALSE;
        }
        sec_chan.data = enable;
    }
    index = CTC_CLI_GET_ARGC_INDEX("include-sci");
    if (0xFF != index)
    {
        sec_chan.data = 1;
        sec_chan.property = CTC_DOT1AE_SC_PROP_INCLUDE_SCI;
    }
    index = CTC_CLI_GET_ARGC_INDEX("without-sci");
    if (0xFF != index)
    {
        sec_chan.data = 0;
        sec_chan.property = CTC_DOT1AE_SC_PROP_INCLUDE_SCI;
    }

    index = CTC_CLI_GET_ARGC_INDEX("protocol-type");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("protocol type", value, argv[index + 1]);
        sec_chan.data = value;
        sec_chan.property = CTC_DOT1AE_SC_PROP_PROTOCOL_MODE;
    }
    if(g_ctcs_api_en)
    {
        ret =  ctcs_dot1ae_update_sec_chan(g_api_ldev, &sec_chan);
    }
    else
    {
        ret =  ctc_dot1ae_update_sec_chan(g_api_ldev, &sec_chan);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_dot1ae_update_sa_cfg,
        ctc_cli_dot1ae_update_sa_cfg_cmd,
        "dot1ae update (sec-chan CHAN_ID) sa-cfg (an AN) {next-pn NEXT_PN| (cipher-suite SUITE|) aes-key AES_KEY (salt SALT ssci SSCI|) \
        |(encryption (confid-offset OFFSET) |no-encryption)|(validateframes_mode(disable|check|strict)|icv-error-action (forward |copy-to-cpu|redirect-to-cpu|discard))}",
        "Dot1AE",
        "Update",
        "Secure channel",
        "CHANNEL ID",
        "SA Config",
        "Association Number",
        "AN",
        "Pn of next encrypt pkt",
        "Packet Numberr",
        "Cipher Suite",
        "GCM_AES_128: 0 , GCM_AES_256: 1, GCM_AES_XPN_128: 2, GCM_AES_XPN_256: 3",
        "Aes key",
        "KEY VALUE",
        "Salt for GCM_AES_XPN",
        "SALT VALUE",
        "Short SCI for GCM_AES_XPN",
        "SSCI VALUE",
        "Packet will be encrypted",
        "Confidentiality offset",
        "(0-offset 0; 1-offset 30; 2-offset 50)",
        "Packet won't be encrypted",
        "Validaterames mode",
        "Disable",
        "Check",
        "Strict",
        "action when icv check failed",
        "normal forwarding",
        "forwarding and copy to cpu",
        "discard and send to cpu",
        "discard"
        )
{
    int32 ret = 0;
    uint8 index = 0;
    ctc_dot1ae_sc_t sc;
    ctc_dot1ae_sa_t sa;
    sal_memset(&sc, 0, sizeof(ctc_dot1ae_sc_t));
    sal_memset(&sa, 0, sizeof(ctc_dot1ae_sa_t));
    sc.ext_data = &sa;
    sc.property = CTC_DOT1AE_SC_PROP_SA_CFG;

    index = CTC_CLI_GET_ARGC_INDEX("sec-chan");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("sec-chan", sc.chan_id, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("an");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("an", sa.an, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("cipher-suite");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("cipher-suite", sa.cipher_suite, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("aes-key");
    if (0xFF != index)
    {
        CTC_SET_FLAG(sa.upd_flag, CTC_DOT1AE_SA_FLAG_KEY);
		if((0==sa.cipher_suite)||(2==sa.cipher_suite))
		{
            if (sal_strlen(argv[index + 1]) <= 16)
            {

                sal_memcpy(sa.key, argv[index + 1],  sal_strlen(argv[index + 1]));

            }
            else
            {
                ctc_cli_out("%%aes-key %s \n\r", ctc_get_error_desc(CTC_E_INVALID_PARAM));
                return CLI_ERROR;
            }
	    }
		else
		{
            if (sal_strlen(argv[index + 1]) <= CTC_DOT1AE_KEY_LEN)
            {

                sal_memcpy(sa.key, argv[index + 1],  sal_strlen(argv[index + 1]));

            }
            else
            {
                ctc_cli_out("%%aes-key %s \n\r", ctc_get_error_desc(CTC_E_INVALID_PARAM));
                return CLI_ERROR;
            }
	    }
    }

    index = CTC_CLI_GET_ARGC_INDEX("salt");
    if (0xFF != index)
    {
        if (sal_strlen(argv[index + 1]) <= sizeof(sa.salt))
        {
            sal_memcpy(sa.salt, argv[index + 1],  sal_strlen(argv[index + 1]));
        }
        else
        {
            ctc_cli_out("salt %s \n\r", ctc_get_error_desc(CTC_E_INVALID_PARAM));
            return CLI_ERROR;
        }
    }

    index = CTC_CLI_GET_ARGC_INDEX("ssci");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("ssci", sa.ssci, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("next-pn");
    if (0xFF != index)
    {
        CTC_SET_FLAG(sa.upd_flag,CTC_DOT1AE_SA_FLAG_NEXT_PN);
        CTC_CLI_GET_UINT64("next-pn", sa.next_pn, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("encryption");
    if (0xFF != index)
    {
        CTC_SET_FLAG(sa.upd_flag, CTC_DOT1AE_SA_FLAG_ENCRYPTION);
        index = CTC_CLI_GET_ARGC_INDEX("confid-offset");
        if (0xFF != index)
        {
            CTC_CLI_GET_UINT8("confid-offset", sa.confid_offset, argv[index + 1]);
        }
    }
    index = CTC_CLI_GET_ARGC_INDEX("no-encryption");
    if (0xFF != index)
    {
        CTC_SET_FLAG(sa.upd_flag, CTC_DOT1AE_SA_FLAG_ENCRYPTION);
        sa.no_encryption = 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("validateframes_mode");
    if (0xFF != index)
    {

        CTC_SET_FLAG(sa.upd_flag, CTC_DOT1AE_SA_FLAG_VALIDATEFRAMES);
        index = CTC_CLI_GET_ARGC_INDEX("disable");
        if (0xFF != index)
        {
            sa.validateframes = CTC_DOT1AE_VALIDFRAMES_DISABLE;
        }
        index = CTC_CLI_GET_ARGC_INDEX("check");
        if (0xFF != index)
        {
            sa.validateframes = CTC_DOT1AE_VALIDFRAMES_CHECK;
        }
        index = CTC_CLI_GET_ARGC_INDEX("strict");
        if (0xFF != index)
        {
            sa.validateframes = CTC_DOT1AE_VALIDFRAMES_STRICT;
        }

    }
    index = CTC_CLI_GET_ARGC_INDEX("icv-error-action");
    if (0xFF != index)
    {
        CTC_SET_FLAG(sa.upd_flag,CTC_DOT1AE_SA_FLAG_ICV_ERROR_ACTION);
        index = CTC_CLI_GET_ARGC_INDEX("forward");
        if (0xFF != index)
        {
            sa.icv_error_action = CTC_EXCP_NORMAL_FWD;
        }
        index = CTC_CLI_GET_ARGC_INDEX("copy-to-cpu");
        if (0xFF != index)
        {
            sa.icv_error_action = CTC_EXCP_FWD_AND_TO_CPU;
        }
        index = CTC_CLI_GET_ARGC_INDEX("redirect-to-cpu");
        if (0xFF != index)
        {
            sa.icv_error_action = CTC_EXCP_DISCARD_AND_TO_CPU;
        }
        index = CTC_CLI_GET_ARGC_INDEX("discard");
        if (0xFF != index)
        {
            sa.icv_error_action = CTC_EXCP_DISCARD;
        }

    }
    if(g_ctcs_api_en)
    {
        ret =  ctcs_dot1ae_update_sec_chan(g_api_ldev,  &sc);
    }
    else
    {
        ret =  ctc_dot1ae_update_sec_chan(g_api_ldev, &sc);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}
CTC_CLI(ctc_cli_dot1ae_add_remove_sec_chan,
        ctc_cli_dot1ae_add_remove_sec_chan_cmd,
        "dot1ae (add|remove) (sec-chan CHAN_ID) ((rx|tx|){p2mp|(pn|xpn)|clear-tag-en|with-ctc-sh|}|)",
        "Dot1AE",
        "Add",
        "Remove",
        "Dot1AE Security Channel",
        "CHANNEL ID",
        "Rx",
        "Tx",
        "p2mp mode",
        "Pn mode per sec-chan",
        "Xpn mode per sec-chan",
        "Clear vlan tag enable",
        "With centec security header"
        )
{
    int32  ret = 0;
    uint8  index = 0;
    uint8  is_add =0;
    ctc_dot1ae_sc_t  sc;

    sc.ext_data= NULL;

    sal_memset(&sc,0,sizeof(ctc_dot1ae_sc_t));
    index = CTC_CLI_GET_ARGC_INDEX("add");
    if (0xFF != index)
    {
        is_add = 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("rx");
    if (0xFF != index)
    {
       sc.dir =  CTC_DOT1AE_SC_DIR_RX;
    }
    index = CTC_CLI_GET_ARGC_INDEX("sec-chan");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("sec-chan", sc.chan_id, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("p2mp");
    if (0xFF != index)
    {
        sc.is_p2mp = 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("xpn");
    if (0xFF != index)
    {
        sc.pn_mode = CTC_DOT1AE_SC_XPN_MODE;
    }
    index = CTC_CLI_GET_ARGC_INDEX("pn");
    if (0xFF != index)
    {
        sc.pn_mode = CTC_DOT1AE_SC_PN_MODE;
    }
    index = CTC_CLI_GET_ARGC_INDEX("clear-tag-en");
    if (0xFF != index)
    {
        sc.clear_tag_en = 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("with-ctc-sh");
    if (0xFF != index)
    {
        sc.with_ctc_sh = 1;
    }
    if (g_ctcs_api_en)
    {
        ret = is_add?ctcs_dot1ae_add_sec_chan(g_api_ldev,&sc):ctcs_dot1ae_remove_sec_chan(g_api_ldev,&sc);
    }
    else
    {
        ret = is_add?ctc_dot1ae_add_sec_chan(g_api_ldev, &sc):ctc_dot1ae_remove_sec_chan(g_api_ldev, &sc);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_dot1ae_set_glb_cfg,
        ctc_cli_dot1ae_set_glb_cfg_cmd,
        "dot1ae set glb-cfg {packet-type (macsec|ctcsec-ipv4|ctcsec-ipv6|cloudsec-ipv4|cloudsec-ipv6|ctcsec-ipv4-ctcsh|ctcsec-ipv6-ctcsh|cloudsec-ipv4-ctcsh|cloudsec-ipv6-ctcsh|ipv4|ipv6|others) \
        key-type (macsec-key|l2-key|ipv4-key|ipv6-key|spi-key) dir (ingress|egress)| encrypt-pn-thrd EN_THRD | decrypt-pn-thrd DE_THRD  | tx-pn-overflow (forward |redirect-to-cpu|discard) |port-mirror-mode MODE |ctcsh-mode MODE| algorithm-type TYPE|{is-xpn|encrypt-xpn-thrd EN_THRD  decrypt-xpn-thrd DE_THRD|}}",
        "Dot1AE",
        "Set",
        "Global cfg",
        "Packet type",
        "Macsec packet [rx/tx]",
        "Ctcsec ipv4 packet [rx]",
        "Ctcsec ipv6 packet [rx]",
        "Cloudsec ipv4 packet [rx]",
        "Cloudsec ipv6 packet [rx]",
        "Ctcsec ipv4 packet with ctc shim header [rx]",
        "Ctcsec ipv6 packet with ctc shim header [rx]",
        "Cloudsec ipv4 packet with ctc shim header [rx]",
        "Cloudsec ipv6 packet with ctc shim header [rx]",
        "IPv4 packet [rx] for packet bypass decryption as plain text, [tx] for ipv4 packet do ctcsec/cloudsec encryption ",
        "Ipv6 key [rx] for packet bypass decryption as plain text, [tx] for ipv6 packet do ctcsec/cloudsec encryption ",
        "Other packet [rx] for packet bypass decryption as plain text, [tx] for other packet do ctcsec/cloudsec encryption",
        "Dot1ae hash key type",
        "Macsec key, CTC_DOT1AE_KEY_MACSEC",
        "L2 key, CTC_DOT1AE_KEY_L2",
        "IPv4 key, CTC_DOT1AE_KEY_IPV4",
        "IPv6 key, CTC_DOT1AE_KEY_IPV6",
        "SPI key, CTC_DOT1AE_KEY_SPI",
        "Direction",
        "Ingress, for decryption",
        "Egress, for encryption",
        "Encrypt pn threshold",
        "EN_THRD",
        "Decrypt pn threshold",
        "DE_THRD",
        "Tx pn overflow action",
        "normal forwarding",
        "discard and send to cpu",
        "discard",
        "Port mirror mode",
        "1-encrypted packets,0-plain packets",
        "1-srcCid come from packet in centec security header,0-srcCid come from ACL",
        "Mode",
        "Algorithm type",
        "Type",
        "Global choose XPN mode",
        "Encrypt xpn threshold",
        "EN_THRD",
        "Decrypt xpn threshold",
        "DE_THRD")
{
    int32  ret = 0;
    uint8  index = 0;
    ctc_dot1ae_glb_cfg_t glb_cfg;

    sal_memset(&glb_cfg, 0, sizeof(ctc_dot1ae_glb_cfg_t));
    if(g_ctcs_api_en)
    {
        ret = ctcs_dot1ae_get_global_cfg(g_api_ldev, &glb_cfg);
    }
    else
    {
        ret = ctc_dot1ae_get_global_cfg(&glb_cfg);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    index = CTC_CLI_GET_ARGC_INDEX("macsec");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_MACSEC;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv4");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv6");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv4");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv6");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv4-ctcsh");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV4_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv6-ctcsh");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV6_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv4-ctcsh");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV4_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv6-ctcsh");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV6_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv4");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv6");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("others");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_OTHERS;
    }

    index = CTC_CLI_GET_ARGC_INDEX("macsec-key");
    if (index != 0xFF)
    {
        glb_cfg.key_type.key_type = CTC_DOT1AE_KEY_MACSEC;
    }
    index = CTC_CLI_GET_ARGC_INDEX("l2-key");
    if (index != 0xFF)
    {
        glb_cfg.key_type.key_type = CTC_DOT1AE_KEY_L2;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv4-key");
    if (index != 0xFF)
    {
        glb_cfg.key_type.key_type = CTC_DOT1AE_KEY_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv6-key");
    if (index != 0xFF)
    {
        glb_cfg.key_type.key_type = CTC_DOT1AE_KEY_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("spi-key");
    if (index != 0xFF)
    {
        glb_cfg.key_type.key_type = CTC_DOT1AE_KEY_SPI;
    }

    index = CTC_CLI_GET_ARGC_INDEX("ingerss");
    if (index != 0xFF)
    {
        glb_cfg.key_type.dir = CTC_INGRESS;
    }
    index = CTC_CLI_GET_ARGC_INDEX("egress");
    if (index != 0xFF)
    {
        glb_cfg.key_type.dir = CTC_EGRESS;
    }

    index = CTC_CLI_GET_ARGC_INDEX("encrypt-pn-thrd");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT64("encrypt-pn-thrd", glb_cfg.tx_pn_thrd, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("decrypt-pn-thrd");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT64("decrypt-pn-thrd", glb_cfg.rx_pn_thrd, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("tx-pn-overflow");
    if (0xFF != index)
    {
        index = CTC_CLI_GET_ARGC_INDEX("forward");
        if (0xFF != index)
        {
            glb_cfg.tx_pn_overflow_action = CTC_EXCP_NORMAL_FWD;
        }
        index = CTC_CLI_GET_ARGC_INDEX("redirect-to-cpu");
        if (0xFF != index)
        {
            glb_cfg.tx_pn_overflow_action = CTC_EXCP_DISCARD_AND_TO_CPU;
        }
        index = CTC_CLI_GET_ARGC_INDEX("discard");
        if (0xFF != index)
        {
            glb_cfg.tx_pn_overflow_action = CTC_EXCP_DISCARD;
        }
    }
    index = CTC_CLI_GET_ARGC_INDEX("port-mirror-mode");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("value", glb_cfg.dot1ae_port_mirror_mode, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsh-mode");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("value", glb_cfg.ctc_sh_mode, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("algorithm-type");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("type", glb_cfg.algorithm_type, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("is-xpn");
    if (0xFF != index)
    {
        glb_cfg.is_xpn = 1;
    }

    index = CTC_CLI_GET_ARGC_INDEX("encrypt-xpn-thrd");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT64("encrypt-xpn-thrd", glb_cfg.tx_xpn_thrd, argv[index + 1]);
        CTC_CLI_GET_UINT64("decrypt-xpn-thrd", glb_cfg.rx_xpn_thrd, argv[index + 3]);
    }
    if(g_ctcs_api_en)
    {
        ret = ctcs_dot1ae_set_global_cfg(g_api_ldev, &glb_cfg);
    }
    else
    {
        ret = ctc_dot1ae_set_global_cfg(&glb_cfg);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_dot1ae_show_glb_cfg,
        ctc_cli_dot1ae_show_glb_cfg_cmd,
        "show dot1ae glb-cfg",
        CTC_CLI_SHOW_STR,
        "Dot1AE",
        "global cfg")
{
    int32  ret = 0;
    ctc_dot1ae_glb_cfg_t glb_cfg;
    char  overflow_action[20] = "\0";

    sal_memset(&glb_cfg, 0, sizeof(ctc_dot1ae_glb_cfg_t));
    if(g_ctcs_api_en)
    {
        ret = ctcs_dot1ae_get_global_cfg(g_api_ldev, &glb_cfg);
    }
    else
    {
        ret = ctc_dot1ae_get_global_cfg(&glb_cfg);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    ctc_cli_out("Global Dot1AE:\n");
    ctc_cli_out("\tencrypt pn threshold: %llu\n", glb_cfg.tx_pn_thrd);
    ctc_cli_out("\tdecrypt pn threshold: %llu\n", glb_cfg.rx_pn_thrd);
    ctc_cli_out("\tencrypt xpn threshold: %llu\n", glb_cfg.tx_xpn_thrd);
    ctc_cli_out("\tdecrypt xpn threshold: %llu\n", glb_cfg.rx_xpn_thrd);

    switch(glb_cfg.tx_pn_overflow_action)
    {
        case CTC_EXCP_NORMAL_FWD :
            sal_strcpy(overflow_action, "forward");
            break;
        case CTC_EXCP_DISCARD_AND_TO_CPU :
            sal_strcpy(overflow_action, "redirect-to-cpu");
            break;
        case CTC_EXCP_DISCARD :
            sal_strcpy(overflow_action, "discard");
            break;
    }
    ctc_cli_out("\txpn overflow action: %s\n", overflow_action);
    ctc_cli_out("\tmirror mode: %d\n", glb_cfg.dot1ae_port_mirror_mode);
    ctc_cli_out("\talgorithm type: %d\n", glb_cfg.algorithm_type);
	ctc_cli_out("\tctc_sh_mode: %d\n", glb_cfg.ctc_sh_mode);

    return ret;
}

CTC_CLI(ctc_cli_dot1ae_show_glb_cfg_key_type,
        ctc_cli_dot1ae_show_glb_cfg_key_type_cmd,
        "show dot1ae glb-cfg packet-type (macsec|ctcsec-ipv4|ctcsec-ipv6|cloudsec-ipv4|cloudsec-ipv6|ctcsec-ipv4-ctcsh|ctcsec-ipv6-ctcsh|cloudsec-ipv4-ctcsh|cloudsec-ipv6-ctcsh|ipv4|ipv6|others) dir (ingress|egress)",
        CTC_CLI_SHOW_STR,
        "Dot1AE",
        "global cfg",
        "Packet type",
        "Macsec packet [rx/tx]",
        "Ctcsec ipv4 packet [rx]",
        "Ctcsec ipv6 packet [rx]",
        "Cloudsec ipv4 packet [rx]",
        "Cloudsec ipv6 packet [rx]",
        "Ctcsec ipv4 packet with ctc shim header [rx/tx]",
        "Ctcsec ipv6 packet with ctc shim header [rx/tx]",
        "Cloudsec ipv4 packet with ctc shim header [rx/tx]",
        "Cloudsec ipv6 packet with ctc shim header [rx/tx]",
        "IPv4 packet [rx] for packet bypass decryption as plain text, [tx] for ipv4 packet do ctcsec/cloudsec encryption ",
        "Ipv6 key [rx] for packet bypass decryption as plain text, [tx] for ipv6 packet do ctcsec/cloudsec encryption ",
        "Other packet [rx] for packet bypass decryption as plain text, [tx] for other packet do ctcsec/cloudsec encryption",
        "Direction",
        "Ingress, for decryption",
        "Egress, for encryption")
{
    uint8 index = 0;
    int32  ret = 0;
    ctc_dot1ae_glb_cfg_t glb_cfg;

    sal_memset(&glb_cfg, 0, sizeof(ctc_dot1ae_glb_cfg_t));

    index = CTC_CLI_GET_ARGC_INDEX("macsec");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_MACSEC;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv4");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv6");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv4");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv6");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv4-ctcsh");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV4_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv6-ctcsh");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV6_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv4-ctcsh");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV4_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv6-ctcsh");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV6_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv4");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv6");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("others");
    if (index != 0xFF)
    {
        glb_cfg.key_type.packet_type = CTC_DOT1AE_PKT_OTHERS;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ingress");
    if (index != 0xFF)
    {
        glb_cfg.key_type.dir = CTC_INGRESS;
    }
    index = CTC_CLI_GET_ARGC_INDEX("egress");
    if (index != 0xFF)
    {
        glb_cfg.key_type.dir = CTC_EGRESS;
    }

    if(g_ctcs_api_en)
    {
        ret = ctcs_dot1ae_get_global_cfg(g_api_ldev, &glb_cfg);
    }
    else
    {
        ret = ctc_dot1ae_get_global_cfg(&glb_cfg);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    ctc_cli_out("-------------- Global Dot1AE packet key type config: ------------------\n");
    if (glb_cfg.key_type.key_type == CTC_DOT1AE_KEY_MACSEC)
    {
        ctc_cli_out("key-type: CTC_DOT1AE_KEY_MACSEC\nkey-table:%s\n",CTC_INGRESS == glb_cfg.key_type.dir ? "DsXSecRxL2MacsecHashKey" : "DsXSecTxL2BasicHashKey");
    }
    else if (glb_cfg.key_type.key_type == CTC_DOT1AE_KEY_L2)
    {
        ctc_cli_out("key-type: CTC_DOT1AE_KEY_L2\nkey-table:%s\n", "DsXSecRxL2BasicHashKey");
    }
    else if (glb_cfg.key_type.key_type == CTC_DOT1AE_KEY_IPV4)
    {
        ctc_cli_out("key-type: CTC_DOT1AE_KEY_IPV4\nkey-table:%s\n", CTC_INGRESS == glb_cfg.key_type.dir ? "DsXSecRxL3L4V4HashKey":"DsXSecTxL3L4V4HashKey");
    }
    else if (glb_cfg.key_type.key_type == CTC_DOT1AE_KEY_IPV6)
    {
        ctc_cli_out("key-type: CTC_DOT1AE_KEY_IPV6\nkey-table:%s\n", CTC_INGRESS == glb_cfg.key_type.dir ? "DsXSecRxL3L4V6HashKey":"DsXSecTxL3L4V6HashKey");
    }
    else if (glb_cfg.key_type.key_type == CTC_DOT1AE_KEY_SPI)
    {
        ctc_cli_out("key-type: CTC_DOT1AE_KEY_SPI\nkey-table:%s\n", CTC_INGRESS == glb_cfg.key_type.dir ? "DsXSecRxSpiHashKey":"DsXSecTxSpiHashKey");
    }
    ctc_cli_out("\n-----------------------------------------------------------------------\n");

    return ret;
}


CTC_CLI(ctc_cli_dot1ae_show_stats,
        ctc_cli_dot1ae_show_stats_cmd,
        "show dot1ae stats (sec-chan CHAN_ID)",
        CTC_CLI_SHOW_STR,
        "Dot1AE",
        "stats",
        "Secure channel",
        "CHANNEL ID"
        )
{
    int32  ret = 0;
    uint8  index = 0;
    uint32 chan_id = 0xffff;
    uint8  i = 0;
    ctc_dot1ae_stats_t stats;

    sal_memset(&stats, 0, sizeof(stats));

    index = CTC_CLI_GET_ARGC_INDEX("sec-chan");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("sec-chan", chan_id, argv[index + 1]);
    }

    if(g_ctcs_api_en)
    {
        ret = ctcs_dot1ae_get_stats(g_api_ldev, chan_id, &stats);
    }
    else
    {
        ret = ctc_dot1ae_get_stats(g_api_ldev, chan_id, &stats);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    ctc_cli_out("global stats:\n");
    ctc_cli_out("%-28s%"PRIu64"\n","inPktsNoSci:", stats.in_pkts_no_sci);
    ctc_cli_out("%-28s%"PRIu64"\n","inPktsUnknownSci", stats.in_pkts_unknown_sci);
    ctc_cli_out("channel %u stats:\n", chan_id);
    for(i = 0; i < 4; i++)
    {
        ctc_cli_out("an[%u]:\n", i);
        ctc_cli_out("%-28s%"PRIu64"\n","outPktsProtected:", stats.an_stats[i].out_pkts_protected);
        ctc_cli_out("%-28s%"PRIu64"\n","outPktsEncrypted:", stats.an_stats[i].out_pkts_encrypted);
        ctc_cli_out("%-28s%"PRIu64"\n","inPktsOk:", stats.an_stats[i].in_pkts_ok);
        ctc_cli_out("%-28s%"PRIu64"\n","inPktsUnchecked:", stats.an_stats[i].in_pkts_unchecked);
        ctc_cli_out("%-28s%"PRIu64"\n","inPktsDelayed:", stats.an_stats[i].in_pkts_delayed);
        ctc_cli_out("%-28s%"PRIu64"\n","inPktsInvalid:", stats.an_stats[i].in_pkts_invalid);
        ctc_cli_out("%-28s%"PRIu64"\n","inPktsNotValid:", stats.an_stats[i].in_pkts_not_valid);
        ctc_cli_out("%-28s%"PRIu64"\n","inPktsLate:", stats.an_stats[i].in_pkts_late);
        ctc_cli_out("%-28s%"PRIu64"\n","inPktsNotUsingSa:", stats.an_stats[i].in_pkts_not_using_sa);
        ctc_cli_out("%-28s%"PRIu64"\n","inPktsUnusedSa:", stats.an_stats[i].in_pkts_unused_sa);

         /*TMM*/
        ctc_cli_out("%-28s%"PRIu64"\n","inPktsBadtag:", stats.an_stats[i].in_pkts_badtag);
        ctc_cli_out("%-28s%"PRIu64"\n","inOctetsDecrypted:", stats.an_stats[i].in_octets_decrypted);
        ctc_cli_out("%-28s%"PRIu64"\n","inOctetsValidated:", stats.an_stats[i].in_octets_validated);
        ctc_cli_out("%-28s%"PRIu64"\n","outPktsUntagged:", stats.an_stats[i].out_pkts_untagged);
        ctc_cli_out("%-28s%"PRIu64"\n","outPktsTooLong:", stats.an_stats[i].out_pkts_toolong);
        ctc_cli_out("%-28s%"PRIu64"\n","outPktsSaNotInUse:", stats.an_stats[i].out_pkts_sa_not_inuse);
        ctc_cli_out("%-28s%"PRIu64"\n","outOctetsEncrypted:", stats.an_stats[i].out_octets_encrypted);
        ctc_cli_out("%-28s%"PRIu64"\n","outOctetsProtected:", stats.an_stats[i].out_octets_protected);
        ctc_cli_out("%-28s%"PRIu64"\n","outPktsUnControlPort:", stats.an_stats[i].out_pkts_uncontrol_port);
    }

    return ret;
}

CTC_CLI(ctc_cli_dot1ae_clear_stats,
        ctc_cli_dot1ae_clear_stats_cmd,
        "dot1ae stats clear (sec-chan CHAN_ID) (an AN|)",
        "Dot1AE",
        "Stats",
        "Clear",
        "Secure channel",
        "CHANNEL ID",
        "Association number",
        "Association number Value"
        )
{
    int32  ret = 0;
    uint8  index = 0;
    uint32 chan_id = 0xffff;
    uint8  an = 0xFF;

    index = CTC_CLI_GET_ARGC_INDEX("sec-chan");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("sec-chan", chan_id, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("an");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("an", an, argv[index + 1]);
    }

    if(g_ctcs_api_en)
    {
        ret = ctcs_dot1ae_clear_stats(g_api_ldev, chan_id, an);
    }
    else
    {
        ret = ctc_dot1ae_clear_stats(g_api_ldev, chan_id, an);
    }
    if (ret < 0)
    {
        ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    return ret;
}

CTC_CLI(ctc_cli_dot1ae_get_sec_chan,
        ctc_cli_dot1ae_get_sec_chan_cmd,
        "show dot1ae (sec-chan CHAN_ID) {an-en|include-sci|sci|reply-protect|reply-window-size|sa-cfg an AN|protocol-type}",
        "Show",
        "Dot1ae",
        "Secure channel",
        "CHANNEL ID",
        "Association number enabled",
        "Include SCI",
        "Secure Channel Identifier",
        "Replay protect",
        "Replay window size",
        "Secure association configuration",
        "Association number",
        "Association number ID",
        "Protocol type"
        )
{
    int32  ret = 0;
    uint8  i = 0;
    uint8  index = 0;
    uint8  an_en[4] = {0};
    uint8  an_en_tmp = 0;
    uint8  include_sci = 0;
	uint8  protocol_type = 0;
    char  icv_action[20] = "\0";
    uint64 window_size = 0;
    uint8  sci_tmp[8] = {0};
    uint32 offset = 0;
    uint8 replay_protect = 0;

    ctc_dot1ae_sc_t sec_chan;
    ctc_dot1ae_sa_t sa;
    sal_memset(&sec_chan, 0, sizeof(ctc_dot1ae_sc_t));
    sal_memset(&sa, 0, sizeof(ctc_dot1ae_sa_t));
    sa.icv_error_action = 0xff;


    index = CTC_CLI_GET_ARGC_INDEX("sec-chan");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("sec-chan", sec_chan.chan_id, argv[index + 1]);
    }
    ctc_cli_out("%-30s:%-3u","chan_id",sec_chan.chan_id);
    if (0xFF != CTC_CLI_GET_ARGC_INDEX("an-en"))/**< [tx/rx] Enable AN to channel  (0~3) */
    {
        sec_chan.property = CTC_DOT1AE_SC_PROP_AN_EN;
        ret = g_ctcs_api_en? ctcs_dot1ae_get_sec_chan(g_api_ldev,&sec_chan):ctc_dot1ae_get_sec_chan(g_api_ldev, &sec_chan);
        if (ret < 0)
        {
            ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
        i = 0;
        while(sec_chan.data){
            an_en_tmp = sec_chan.data % 2;
            sec_chan.data = sec_chan.data / 2;
            an_en[i++] = an_en_tmp;
        }
        ctc_cli_out("\n%-30s:","an-en[TX/RX]");
        for (i=3;i>0;i--)
        {
            ctc_cli_out("%d",an_en[i]);
        }
        ctc_cli_out("%d",an_en[0]);
    }
    if (0xFF != CTC_CLI_GET_ARGC_INDEX("include-sci"))/**< [tx] Transmit SCI in MacSec Tag*/
    {
        sec_chan.property = CTC_DOT1AE_SC_PROP_INCLUDE_SCI;
        ret = g_ctcs_api_en? ctcs_dot1ae_get_sec_chan(g_api_ldev,&sec_chan):ctc_dot1ae_get_sec_chan(g_api_ldev,&sec_chan);
        if (ret < 0)
        {
            ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
        include_sci = sec_chan.data;
        sec_chan.data = 0;
        ctc_cli_out("\n%-30s:%-3d", "include-sci[TX]",include_sci);
    }
    if (0xFF != CTC_CLI_GET_ARGC_INDEX("sci"))/**< [tx/rx] Secure Channel Identifier,64 bit. uint32 value[2]*/
    {
        sec_chan.property = CTC_DOT1AE_SC_PROP_SCI;
        sec_chan.ext_data = sci_tmp;
        ret = g_ctcs_api_en? ctcs_dot1ae_get_sec_chan(g_api_ldev,&sec_chan):ctc_dot1ae_get_sec_chan(g_api_ldev,&sec_chan);
        if (ret < 0)
        {
            ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
        ctc_cli_out("\n%-30s:0x","SCI[TX/RX]");
        for (i=0;i<sizeof(sci_tmp);i++)
        {
            ctc_cli_out("%02x",sci_tmp[i]);
        }
    }
    if (0xFF != CTC_CLI_GET_ARGC_INDEX("reply-protect"))/**< [rx] Replay protect windows size*/
    {
        sec_chan.property = CTC_DOT1AE_SC_PROP_REPLAY_PROTECT_EN;
        ret = g_ctcs_api_en? ctcs_dot1ae_get_sec_chan(g_api_ldev,&sec_chan):ctc_dot1ae_get_sec_chan(g_api_ldev,&sec_chan);
        if (ret < 0)
        {
            ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
        replay_protect = sec_chan.data;
        ctc_cli_out("\n%-30s:%s","replay protect [RX]",replay_protect?"enable":"disable");
        sec_chan.data = 0;
    }
    if (0xFF != CTC_CLI_GET_ARGC_INDEX("reply-window-size"))/**< [rx] Replay protect windows size*/
    {
        sec_chan.property = CTC_DOT1AE_SC_PROP_REPLAY_WINDOW_SIZE;
        ret = g_ctcs_api_en? ctcs_dot1ae_get_sec_chan(g_api_ldev,&sec_chan):ctc_dot1ae_get_sec_chan(g_api_ldev,&sec_chan);
        if (ret < 0)
        {
            ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
        window_size = sec_chan.data;
        ctc_cli_out("\n%-30s:%-3llu","replay windiw size[RX]",window_size);
        sec_chan.data = 0;
    }
    if (0xFF != CTC_CLI_GET_ARGC_INDEX("sa-cfg"))/**< [tx/rx] configure SA Property, ctc_dot1ae_sa_t*/
    {
        sec_chan.property = CTC_DOT1AE_SC_PROP_SA_CFG;
        sec_chan.ext_data = &sa;
        index = CTC_CLI_GET_ARGC_INDEX("an");
        CTC_CLI_GET_UINT8("an",sa.an, argv[index + 1]);
        ret = g_ctcs_api_en? ctcs_dot1ae_get_sec_chan(g_api_ldev,&sec_chan):ctc_dot1ae_get_sec_chan(g_api_ldev,&sec_chan);
        if (ret < 0)
        {
            ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
        offset = sa.confid_offset==0?0:(sa.confid_offset==1?30:50);
        ctc_cli_out("\n%-30s:%-3u\n%-30s:%-3llu\n%-30s:%-3llu\n%-30s:%-3u\n%-30s:%-3u\n%-30s:%-3u\n%-30s:%-s\n", \
                            "an",sa.an,"next-PN[TX/RX]",sa.next_pn,"lowest-PN[RX]",sa.lowest_pn,\
                            "no-encryption[TX]",sa.no_encryption,"confid-offset[TX]",offset,\
                            "in-use[TX/RX]",sa.in_use,"key[TX/RX]",sa.key);
        ctc_cli_out("%-24s [HEX]:"," ");
        for (i=0;i<sizeof(sa.key);i++)
        {
            if(i && !(i%2))
            {
                ctc_cli_out(" ");
            }
            ctc_cli_out("%x",sa.key[i]);
        }
        ctc_cli_out("\n");
        ctc_cli_out("%-30s:","salt:[TX/RX]");
        for (i=0;i<sizeof(sa.salt);i++)
        {
            ctc_cli_out("%c",sa.salt[i]);
        }
        ctc_cli_out("\n");
        ctc_cli_out("%-30s:0x%x\n","ssci:[TX/RX]",sa.ssci);
        ctc_cli_out("%-30s:%u\n","cipher_suite:[TX/RX]",sa.cipher_suite);
        ctc_cli_out("%-30s:%u\n","icv validate_frames mode[RX]",sa.validateframes);
        if(sa.icv_error_action != 0xff)
        {
            switch(sa.icv_error_action)
            {
            case CTC_EXCP_NORMAL_FWD :
                sal_strcpy(icv_action, "forward");
                break;
            case CTC_EXCP_FWD_AND_TO_CPU :
                sal_strcpy(icv_action, "copy-to-cpu");
                break;
            case CTC_EXCP_DISCARD_AND_TO_CPU :
                sal_strcpy(icv_action, "redirect-to-cpu");
                break;
            case CTC_EXCP_DISCARD :
                sal_strcpy(icv_action, "discard");
                break;
            }
            ctc_cli_out("%-30s:%-3s\n","icv_error_action[RX]",icv_action);
        }
    }
    if (0xFF != CTC_CLI_GET_ARGC_INDEX("protocol-type"))
    {
        sec_chan.property = CTC_DOT1AE_SC_PROP_PROTOCOL_MODE;
        ret = g_ctcs_api_en? ctcs_dot1ae_get_sec_chan(g_api_ldev, &sec_chan) : ctc_dot1ae_get_sec_chan(g_api_ldev, &sec_chan);
        if (ret < 0)
        {
            ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
            return CLI_ERROR;
        }
        protocol_type = sec_chan.data;
        sec_chan.data = 0;
        ctc_cli_out("\n%-30s:%-3d", "protocol-type[TX/RX]", protocol_type);
    }
    ctc_cli_out("\n%-30s:%-3s\n", "dir",sec_chan.dir?"rx":"tx");
    return ret;
}

CTC_CLI(ctc_cli_dot1ae_debug_on,
        ctc_cli_dot1ae_debug_on_cmd,
        "debug dot1ae (ctc | sys) (debug-level {func|param|info|error} |)",
        CTC_CLI_DEBUG_STR,
        CTC_CLI_DOT1AE_STR,
        "Ctc layer",
        "Sys layer",
        CTC_CLI_DEBUG_LEVEL_STR,
        CTC_CLI_DEBUG_LEVEL_FUNC,
        CTC_CLI_DEBUG_LEVEL_PARAM,
        CTC_CLI_DEBUG_LEVEL_INFO,
        CTC_CLI_DEBUG_LEVEL_ERROR)
{
    uint32 typeenum = 0;
    uint8 level = CTC_DEBUG_LEVEL_INFO;
    uint8 index = 0;

    index = CTC_CLI_GET_ARGC_INDEX("debug-level");
    if (index != 0xFF)
    {
        level = CTC_DEBUG_LEVEL_NONE;
        index = CTC_CLI_GET_ARGC_INDEX("func");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_FUNC;
        }

        index = CTC_CLI_GET_ARGC_INDEX("param");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_PARAM;
        }

        index = CTC_CLI_GET_ARGC_INDEX("info");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_INFO;
        }

        index = CTC_CLI_GET_ARGC_INDEX("error");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_ERROR;
        }
    }

    if (0 == sal_memcmp(argv[0], "ctc", 3))
    {
        typeenum = DOT1AE_CTC;
    }
    else if (0 == sal_memcmp(argv[0], "sys", 3))
    {
        typeenum = DOT1AE_SYS;
    }

    ctc_debug_set_flag("dot1ae", "dot1ae", typeenum, level, TRUE);

    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_dot1ae_debug_off,
        ctc_cli_dot1ae_debug_off_cmd,
        "no debug dot1ae (ctc | sys)",
        CTC_CLI_NO_STR,
        CTC_CLI_DEBUG_STR,
        CTC_CLI_DOT1AE_STR,
        "Ctc layer",
        "Sys layer")
{
    uint32 typeenum = 0;
    uint8 level = 0;

    if (0 == sal_memcmp(argv[0], "ctc", 3))
    {
        typeenum = DOT1AE_CTC;
    }
    else if (0 == sal_memcmp(argv[0], "sys", 3))
    {
        typeenum = DOT1AE_SYS;
    }

    ctc_debug_set_flag("dot1ae", "dot1ae", typeenum, level, FALSE);

    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_dot1ae_show_debug,
        ctc_cli_dot1ae_show_debug_cmd,
        "show debug dot1ae (ctc | sys)",
        CTC_CLI_SHOW_STR,
        CTC_CLI_DEBUG_STR,
        CTC_CLI_DOT1AE_STR,
        "Ctc layer",
        "Sys layer")
{
    uint32 typeenum = 0;
    uint8 level = 0;
    uint8 en = 0;

    if (0 == sal_memcmp(argv[0], "ctc", 3))
    {
        typeenum = DOT1AE_CTC;
    }
    else if (0 == sal_memcmp(argv[0], "sys", 3))
    {
        typeenum = DOT1AE_SYS;
    }

    en = ctc_debug_get_flag("dot1ae", "dot1ae", typeenum, &level);
    ctc_cli_out("dot1ae:%s debug %s level:%s\n", argv[0],
                en ? "on" : "off", ctc_cli_get_debug_desc(level));

    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_dot1ae_set_hash_sel,
        ctc_cli_dot1ae_set_hash_sel_cmd,
        "dot1ae set hash-sel gport GPORT packet-type (macsec|ctcsec-ipv4|ctcsec-ipv6|cloudsec-ipv4|cloudsec-ipv6|ctcsec-ipv4-ctcsh|ctcsec-ipv6-ctcsh|cloudsec-ipv4-ctcsh|cloudsec-ipv6-ctcsh|ipv4|ipv6|others)\
         key-field-list {port|sci|svlan|cvlan|eth-type|ip-sa|ip-da|ipv6-sa|ipv6-da|ip-protocol|l4-src-port|l4-dst-port|spi|none} dir (ingress|egress)",
        "Dot1AE module",
        "Set",
        "Set dot1ae Hash lookup key-field select according to gport + packet-type",
        "gport",
        "GPORT",
        "Packet type to be decrypted or encrypted",
        "Macsec packet [rx/tx]",
        "Ctcsec ipv4 packet [rx]",
        "Ctcsec ipv6 packet [rx]",
        "Cloudsec ipv4 packet [rx]",
        "Cloudsec ipv6 packet [rx]",
        "Ctcsec ipv4 packet with ctc shim header [rx/tx]",
        "Ctcsec ipv6 packet with ctc shim header [rx/tx]",
        "Cloudsec ipv4 packet with ctc shim header [rx/tx]",
        "Cloudsec ipv6 packet with ctc shim header [rx/tx]",
        "IPv4 packet [rx] for packet bypass decryption as plain text, [tx] for ipv4 packet do ctcsec/cloudsec encryption ",
        "Ipv6 key [rx] for packet bypass decryption as plain text, [tx] for ipv6 packet do ctcsec/cloudsec encryption ",
        "Other packet [rx] for packet bypass decryption as plain text, [tx] for other packet do ctcsec/cloudsec encryption",
        "Key field list",
        "Port",
        "Dot1ae SCI",
        "Svlan",
        "Cvlan",
        "Ether type",
        "IPv4 destination address",
        "IPv4 source address",
        "IPv6 destination address",
        "IPv6 source address",
        "IP protocol",
        "L4 source port",
        "L4 destination port",
        "Dot1ae SPI",
        "None, clear hash key field sel",
        "Direction",
        "Ingress, for decryption",
        "Egress, for encryption")
{
    ctc_field_key_t field_key_list[CTC_DOT1AE_FIELD_KEY_NUM];
    int32  ret = 0;
    uint8  index = 0;
    uint32 field_cnt = 0;
    ctc_dot1ae_hash_sel_t hash_sel;
    sal_memset(&hash_sel, 0, sizeof(ctc_dot1ae_hash_sel_t));
    sal_memset(field_key_list, 0, sizeof(field_key_list));
    hash_sel.field_key_list = field_key_list;

    CTC_CLI_GET_UINT32_RANGE("gport", hash_sel.gport, argv[0], 0, CTC_MAX_UINT32_VALUE);

    index = CTC_CLI_GET_ARGC_INDEX("macsec");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_MACSEC;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv4");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv6");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv4");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv6");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv4-ctcsh");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV4_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv6-ctcsh");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV6_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv4-ctcsh");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV4_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv6-ctcsh");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV6_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv4");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv6");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("others");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_OTHERS;
    }

    index = CTC_CLI_GET_ARGC_INDEX("port");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_PORT;
    }
    index = CTC_CLI_GET_ARGC_INDEX("sci");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_DOT1AE_SCI;
    }
    index = CTC_CLI_GET_ARGC_INDEX("svlan");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_SVLAN_ID;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cvlan");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_CVLAN_ID;
    }
    index = CTC_CLI_GET_ARGC_INDEX("eth-type");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_ETHER_TYPE;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ip-sa");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_IP_SA;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ip-da");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_IP_DA;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv6-sa");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_IPV6_SA;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv6-da");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_IPV6_DA;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ip-protocol");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_IP_PROTOCOL;
    }
    index = CTC_CLI_GET_ARGC_INDEX("l4-src-port");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_L4_SRC_PORT;
    }
    index = CTC_CLI_GET_ARGC_INDEX("l4-dst-port");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_L4_DST_PORT;
    }
    index = CTC_CLI_GET_ARGC_INDEX("spi");
    if (index != 0xFF)
    {
        hash_sel.field_key_list[field_cnt++].type = CTC_FIELD_KEY_DOT1AE_SPI;
    }
    index = CTC_CLI_GET_ARGC_INDEX("none");
    if (index != 0xFF)
    {
        field_cnt = 0;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ingress");
    if (index != 0xFF)
    {
        hash_sel.dir = CTC_INGRESS;
    }
    index = CTC_CLI_GET_ARGC_INDEX("egress");
    if (index != 0xFF)
    {
        hash_sel.dir = CTC_EGRESS;
    }
    hash_sel.field_cnt = field_cnt;

    if(g_ctcs_api_en)
     {
         ret =  ctcs_dot1ae_set_hash_field_sel(g_api_ldev, &hash_sel);
     }
     else
     {
         ret =  ctc_dot1ae_set_hash_field_sel(&hash_sel);
     }
     if (ret < 0)
     {
         ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
         return CLI_ERROR;
     }

    return ret;
}


CTC_CLI(ctc_cli_dot1ae_show_hash_sel,
        ctc_cli_dot1ae_show_hash_sel_cmd,
        "show dot1ae hash-sel gport GPORT packet-type (macsec|ctcsec-ipv4|ctcsec-ipv6|cloudsec-ipv4|cloudsec-ipv6|ctcsec-ipv4-ctcsh|ctcsec-ipv6-ctcsh|cloudsec-ipv4-ctcsh|cloudsec-ipv6-ctcsh|ipv4|ipv6|others) dir (ingress|egress)",
        "show",
        "Dot1AE module",
        "Set dot1ae Hash lookup key-field select according to gport + packet-type",
        "gport",
        "GPORT",
        "Packet type to be decrypted or encrypted",
        "Macsec packet [rx/tx]",
        "Ctcsec ipv4 packet [rx]",
        "Ctcsec ipv6 packet [rx]",
        "Cloudsec ipv4 packet [rx]",
        "Cloudsec ipv6 packet [rx]",
        "Ctcsec ipv4 packet with ctc shim header [rx/tx]",
        "Ctcsec ipv6 packet with ctc shim header [rx/tx]",
        "Cloudsec ipv4 packet with ctc shim header [rx/tx]",
        "Cloudsec ipv6 packet with ctc shim header [rx/tx]",
        "IPv4 packet [rx] for packet bypass decryption as plain text, [tx] for ipv4 packet do ctcsec/cloudsec encryption ",
        "Ipv6 key [rx] for packet bypass decryption as plain text, [tx] for ipv6 packet do ctcsec/cloudsec encryption ",
        "Other packet [rx] for packet bypass decryption as plain text, [tx] for other packet do ctcsec/cloudsec encryption",
        "Direction",
        "Ingress, for decryption",
        "Egress, for encryption")
{

    int32  ret = 0;
    uint8  index = 0;
    ctc_dot1ae_hash_sel_t hash_sel;
    ctc_field_key_t field_key_list[CTC_DOT1AE_FIELD_KEY_NUM];
    sal_memset(field_key_list, 0, sizeof(field_key_list));
    sal_memset(&hash_sel, 0, sizeof(ctc_dot1ae_hash_sel_t));
    hash_sel.field_key_list = field_key_list;

    CTC_CLI_GET_UINT32_RANGE("gport", hash_sel.gport, argv[0], 0, CTC_MAX_UINT32_VALUE);

    index = CTC_CLI_GET_ARGC_INDEX("macsec");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_MACSEC;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv4");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv6");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv4");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv6");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv4-ctcsh");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV4_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ctcsec-ipv6-ctcsh");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CTCSEC_IPV6_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv4-ctcsh");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV4_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cloudsec-ipv6-ctcsh");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_CLOUDSEC_IPV6_CTCSH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv4");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_IPV4;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ipv6");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_IPV6;
    }
    index = CTC_CLI_GET_ARGC_INDEX("others");
    if (index != 0xFF)
    {
        hash_sel.packet_type = CTC_DOT1AE_PKT_OTHERS;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ingress");
    if (index != 0xFF)
    {
        hash_sel.dir = CTC_INGRESS;
    }
    index = CTC_CLI_GET_ARGC_INDEX("egress");
    if (index != 0xFF)
    {
        hash_sel.dir = CTC_EGRESS;
    }

    if(g_ctcs_api_en)
     {
         ret =  ctcs_dot1ae_get_hash_field_sel(g_api_ldev, &hash_sel);
     }
     else
     {
         ret =  ctc_dot1ae_get_hash_field_sel(&hash_sel);
     }
     if (ret < 0)
     {
         ctc_cli_out("%% ret =%d, %s\n", ret, ctc_get_error_desc(ret));
         return CLI_ERROR;
     }
     else
     {
         ctc_cli_out("--------------------- Dot1ae hash key field select info --------------------\n");
         for (index = 0; index < hash_sel.field_cnt; index++)
         {
            switch(hash_sel.field_key_list[index].type)
            {
                case CTC_FIELD_KEY_PORT:
                    ctc_cli_out("%s\n","port");
                    break;
                case CTC_FIELD_KEY_DOT1AE_SCI:
                    ctc_cli_out("%s\n","dot1ae SCI");
                    break;
                case CTC_FIELD_KEY_SVLAN_ID:
                    ctc_cli_out("%s\n","svlan");
                    break;
                case CTC_FIELD_KEY_CVLAN_ID:
                    ctc_cli_out("%s\n","cvlan");
                    break;
                case CTC_FIELD_KEY_ETHER_TYPE:
                    ctc_cli_out("%s\n","ether type");
                    break;
                case CTC_FIELD_KEY_IP_SA:
                    ctc_cli_out("%s\n","ip-sa");
                    break;
                case CTC_FIELD_KEY_IP_DA:
                    ctc_cli_out("%s\n","ip-da");
                    break;
                case CTC_FIELD_KEY_IPV6_SA:
                    ctc_cli_out("%s\n","ipv6-sa");
                    break;
                case CTC_FIELD_KEY_IPV6_DA:
                    ctc_cli_out("%s\n","ipv6-da");
                    break;
                case CTC_FIELD_KEY_IP_PROTOCOL:
                    ctc_cli_out("%s\n","ip-protocol");
                    break;
                case CTC_FIELD_KEY_L4_DST_PORT:
                    ctc_cli_out("%s\n","l4 dest port");
                    break;
                case CTC_FIELD_KEY_L4_SRC_PORT:
                    ctc_cli_out("%s\n","l4 source port");
                    break;
                case CTC_FIELD_KEY_DOT1AE_SPI:
                    ctc_cli_out("%s\n","SPI");
                    break;
                default:
                    break;
            }
         }
         ctc_cli_out("------------------------------------------------------- --------------------\n");
     }

    return ret;
}


int32
ctc_dot1ae_cli_init(void)
{

    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_update_sa_cfg_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_update_sec_chan_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_get_sec_chan_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_add_remove_sec_chan_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_set_glb_cfg_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_show_glb_cfg_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_show_stats_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_clear_stats_cmd);

    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_debug_on_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_debug_off_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_show_debug_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_set_hash_sel_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_show_hash_sel_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_dot1ae_show_glb_cfg_key_type_cmd);

    return CLI_SUCCESS;
}

#endif

